#ifndef _FEED_MANAGER_H_
#define _FEED_MANAGER_H_
#include "../net/IMsgDispatcher.h"
#include "../common/CTimerEventHandler.h"
#include <list>
#include <sstream>
#include <string>

using namespace omg;
#define CONFIG_FILE "config/chat_server.xml"

struct CFeed{
};

class CFeedManager:public CTimerEventHandler{
	public:
		CFeedManager(IMsgDispatcher* pDispatcher,int time_check=5):CTimerEventHandler(pDispatcher,time_check){
			Init();
		}

		void Init(){
			TiXmlDocument doc(CONFIG_FILE);  
			bool loadFile = doc.LoadFile();
			if(loadFile == false){  
				LOG(ERROR)<<"Config file not found!";
				return;
			}
			TiXmlNode* firstNode = doc.FirstChild("chat_server");
			if(firstNode == NULL){
				LOG(ERROR)<<"error of xml file";
				exit(1);
			}
			TiXmlElement *ele = firstNode->ToElement();
			const char* ip_buffer = ele->Attribute("ip");
			const char* ip_port = ele->Attribute("udp_port");
			
			int port = atoi(ip_port);	
			_port = port;

		}

		~CFeedManager(){}
		void check_timer();
	private:
		int _port;
		std::list<CFeed> _feed_list;
};
#endif
